#coding=utf-8

from mongoengine import *  
from HomeKit.settings import DBNAME
import datetime

connect(DBNAME)

# connect('storage')


class ASDESCModel(Document):
    ASName = StringField(required=True)
    ASDescription = StringField()
    ASType = StringField(required=True)
    ASURL = StringField()
    ASMethod = StringField()
    ASContent = StringField()
    ASRequestHeader = StringField()
    ASResponseUnit = StringField()
    
class LHSDESCModel(EmbeddedDocument):
    ASName = StringField(required=True)
    LHSType = StringField(required=True)
    LHGCopmare = StringField(required=True)
    LHSValue = StringField(required=True)

class RHSDESCModel(EmbeddedDocument):
    ASName = StringField(required=True)
    RHSParam = StringField(required=True)
    

class UGRSDESCModel(Document):
    RSName = StringField(required=True)
    RSDescription = StringField(required=True)
    RSModifiedtime = DateTimeField(required=True)
    RSTag = StringField()
    RSSalience = StringField(required=True)
    RSSatus = IntField(required=True,default=1)
    LHSList = ListField(EmbeddedDocumentField(LHSDESCModel),required=True)
    RHSList = ListField(EmbeddedDocumentField(RHSDESCModel),required=True)

class MessageModel(Document):
    RSID = StringField()
    MSGType = StringField(required=True)
    MSGContent = StringField(required=True)
    MSGTime = DateTimeField(required=True)
    MSGReaded = IntField(required=True,default=0)

class NoticeModel(Document):
    MSGContent = StringField(required=True)
    MSGTime = DateTimeField(required=True)
    MSGReaded = IntField(required=True,default=0)
    


